package com.gzx.plugin.data.wxjk.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gzx.plugin.data.wxjk.entity.DataWxjkDdzwxx;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author xbl
 */
public interface DataWxjkDdzwxxMapper extends BaseMapper<DataWxjkDdzwxx> {

    // 查询客户信息，当月最新的那一条
    @Select("<script>" +
            "select distinctrow business_id businessId,cust_code custCode from data_wxjk_ddzwxx " +
            " where create_time &gt; STR_TO_DATE(DATE_FORMAT(CURRENT_DATE, '%Y-%m-01'), '%Y-%m-%d %H:%i:%s') " +
            " and business_id in " +
            "<foreach collection='list' item='businessId' open='(' separator=',' close=')'>" +
            "#{businessId}" +
            "</foreach> " +
            "</script>")
    List<DataWxjkDdzwxx> getCustom(@Param("list") List<String> list);
    
    
    // 查询客户信息
    @Select("<script>" +
            "select distinct business_id businessId,cust_code custCode from data_wxjk_ddzwxx " +
            " where create_time BETWEEN #{start} and #{end} " +
            " and business_id in " +
            "<foreach collection='list' item='businessId' open='(' separator=',' close=')'>" +
            "#{businessId}" +
            "</foreach> " +
            "</script>")
    List<DataWxjkDdzwxx> getCustomByDate(@Param("start") String start,@Param("end") String end,@Param("list") List<String> list);

}
